package com.healthySys.common.result;

import lombok.Data;

import java.util.Collection;
import java.util.List;

@Data
public class PageResult<E> {

    private Integer code;
    private String msg;
    private Long total;
    private List rows;

    public PageResult(Integer code, String msg, Long total, List rows) {
        this.code = code;
        this.msg = msg;
        this.total = total;
        this.rows = rows;
    }

    public static<E> PageResult<E> success(Long total, List rows){
        return new PageResult<>(1,"分页查询成功",total,rows);
    }

    public static<E> PageResult<Collection<E>> error(Long total, List rows){
        return new PageResult<>(1,"分页查询失败",null,null);
    }
}

